package Thread;

import java.util.Timer;
import java.util.TimerTask;

public class Demo37 {
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            public void run() {
                System.out.println(Thread.currentThread().getName() + " is running");
            }
        },3000);
        timer.schedule(new TimerTask() {
            public void run() {
                System.out.println(Thread.currentThread().getName() + " is running");
            }
        },2000);
        timer.schedule(new TimerTask() {
            public void run() {
                System.out.println(Thread.currentThread().getName() + " is running");
            }
        },1000);
        System.out.println(Thread.currentThread().getName() + " is running");
    }
}
